/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package it.polimi.wcalendar.business.security.control;

import java.io.IOException;
import java.util.Date;
import javax.ejb.Schedule;
import javax.ejb.Stateless;
import org.json.JSONException;

/**
 *
 * @author baldo
 */
@Stateless
public class WeatherUpdateTimerSessionBean {

    /**
     *
     */
    @Schedule(minute = "*", second = "*", dayOfMonth = "*", month = "*", year = "*", hour = "*/1", dayOfWeek = "Mon-Sun", persistent = false)
    
    public void myTimer(){
        System.out.println("Timer event: " + new Date());
        try{
        (new OpenWeatherDownloader()).Parse();
        }catch (IOException e){
        System.out.println("IOException occurred");
        }catch (JSONException e){
            System.out.println("JSONException occurred");
                
        }
    }

    // Add business logic below. (Right-click in editor and choose
    // "Insert Code > Add Business Method")
}
